package cn.iocoder.yudao.module.system.dal.mysql.suggestion;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.dal.dataobject.suggestion.SuggestionDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.system.controller.admin.suggestion.vo.*;

/**
 * 意见建议 Mapper
 *
 * @author 万民匠心
 */
@Mapper
public interface SuggestionMapper extends BaseMapperX<SuggestionDO> {

    default PageResult<SuggestionDO> selectPage(SuggestionPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SuggestionDO>()
                .inIfPresent(SuggestionDO::getUserId, reqVO.getUserIds())
                .likeIfPresent(SuggestionDO::getContent, reqVO.getContent())
                .likeIfPresent(SuggestionDO::getReplyContent, reqVO.getReplyContent())
                .betweenIfPresent(SuggestionDO::getReplyTime, reqVO.getReplyTime())
                .betweenIfPresent(SuggestionDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(SuggestionDO::getId));
    }

}